package dev.bong.mapper;



import dev.bong.annotation.AutoFill;
import dev.bong.enumeration.OperationType;
import dev.bong.pojo.entity.LabRegister;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author: bong~
 * @description: TODO
 * @date: 2024/4/15 20:29
 * @version: 1.0
 */

@Mapper
public interface LabRegisterMapper {

    List<LabRegister> selectByTeacherIdAndSemester(Integer teacherId,String semester);

    @AutoFill(OperationType.INSERT)
    void addRegister(LabRegister labRegister);


    @Select("select register_status from lab_register where id = #{registerId}")
    Integer getRegisterStatusById(Integer registerId);

    @Update("update lab_register set register_status = #{status},update_by=#{userId},update_time=#{now} " +
            "where id = #{registerId}")
    void updateRegisterStatusById(Integer registerId, Integer status, Integer userId, LocalDateTime now);

    @AutoFill(OperationType.UPDATE)
    void updateRegister(LabRegister labRegister);

    List<LabRegister> getRegisterList();

    LabRegister getRegisterById(Integer id);
}
